<%@ include file="/taglibs.jsp"%>
<fmt:message key="date.format" var="df" scope="page"/>
<head>
	<title><fmt:message key="processingHistory.listform.title"/></title>
</head>


<s:form name="filterFileByDate" action="histories" method="post" validate="true">
<tr>
	<td width="100px">
        <s:property value="getText('report.fromdate')"/>
    </td>
    <td width="200px">
        <s:textfield id="fromDate" readonly="true" name="fromDate" size="11" theme="simple" required="true"/>
    </td>
	<td width="60px">
        <s:property value="getText('report.todate')"/>
    </td>
    <td>
        <s:textfield id="toDate" name="toDate" readonly="true" size="11" theme="simple" required="true"/>
    </td>   
    <td align="right">
    
    		<button type="submit" onclick="this.blur()" class="button"
					name="reportOnTime">
					<fmt:message key="button.execute.title"></fmt:message>
					<img src="${ctx}/images/report.png" align="left" height="20"
						width="20">
				</button>
    
    </td>  
</tr>  
</s:form>
<p></p>

<s:set name="lstFileMgrRequest" value="historyList" scope="request"/>
<display:table name="lstFileMgrRequest" class="table" requestURI="" id="fmgr" >
	
    <display:column property="file.category.categoryName" titleKey="category.item_name"/>
    <display:column style="width:200px;" property="file.submitter" titleKey="file.submitter"/>
    
   
	<display:column titleKey="processingHistory.listform.table.header.receiver" escapeXml="true">
	    <c:choose>
			<c:when test="${fmgr.approveStatus == false}">
				${fmgr.receiverRejectFile.fullname} (${fmgr.receiverRejectFile.department.name})
			</c:when>
			<c:when test="${fmgr.approveStatus == true}">
				${fmgr.approver.fullname} (${fmgr.approver.department.name})
			</c:when>
			<c:when test="${fmgr.approveStatus == null}">
				${fmgr.approver.fullname} (${fmgr.approver.department.name})
			</c:when>
		</c:choose>
	</display:column>
	
	<display:column style="width:110px;"  titleKey="processingHistory.listform.table.header.time" escapeXml="true">
    	<joda:format value="${fmgr.receivedDate}" pattern="hh:mm dd/MM/yyyy"/>
    </display:column>
    
	<%-- <display:column titleKey="processingHistory.listform.table.header.department" escapeXml="true">
	    <c:choose>
			<c:when test="${fmgr.approveStatus == false}">
				${fmgr.receiverRejectFile.department.name}
			</c:when>
			<c:when test="${fmgr.approveStatus == true}">
				${fmgr.approver.department.name}
			</c:when>
			<c:when test="${fmgr.approveStatus == null}">
				${fmgr.approver.department.name}
			</c:when>
		</c:choose>
	</display:column> --%>
    <%-- <display:column property="approvedComment" titleKey="approved_comment" escapeXml="true"/> --%>
    <display:column style="width:30px;" sortable="false" href="viewFile.html" media="html" paramId="id" paramProperty="file.id" titleKey="button.detail.title">
        Xem
    </display:column>
</display:table>
<script type="text/javascript">
		
		var cal = Calendar.setup({
	          onSelect: function(cal) { cal.hide();},
	      });
	      cal.manageFields("fromDate","fromDate","%d/%m/%Y");
	      cal.manageFields("toDate","toDate","%d/%m/%Y");

	      $(document).ready(function (){
	      		var currentTime = new Date();
	      		var month = currentTime.getMonth() + 1;
	      		var day = currentTime.getDate();
	      		if(month < 10) month = "0" + month;
	      		if(day < 10) day = "0" + day;
	      		var year = currentTime.getFullYear();
	      		
	      		var today = day + "/" + month + "/" + year;
	      		
	      		if($("#fromDate").val()=="")
	      	  		$("#fromDate").val(today);
	      		
	      		if($("#toDate").val()=="")
	      	  		$("#toDate").val(today);
	      	});
	</script>